﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="BugSysSolution.XMLAndXSLT.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../Style/site.css" rel="stylesheet" type="text/css" />
    <script src="../Javascript/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../Javascript/common.js" type="text/javascript"></script>
    <script src="../Javascript/XmlHandle.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table id="tab1" class="tab">
            
        </table>
    </div>
    </form>
</body>
</html>
<script type="text/javascript">
    var obj1 = function () {
        this.init = function (protos, source) {
            var html = "";
            html += "<tr style='background-color:green'>";
            for (var i = 0; i < protos.length; i++) {
                html += "<td>" + protos[i] + "</td>";
            }
            html += "</tr>";

            $("#tab1").append(html);
        }
    }

    var obj2 = function () {
        this.init = function (protos, source) {
            var html = "";
            html += "<tr style='background-color:green'>";
            for (var i = 0; i < protos.length; i++) {
                html += "<td>" + protos[i] + "</td>";
            }
            html += "</tr>";
            for (var i = 0; i < source.length; i++) {
                html += "<tr>";
                for (var j = 0; j < protos.length; j++) {
                    html += "<td>" + source[i][protos[j]] + "</td>";
                }
                html += "</tr>";
            }
            $("#tab1").append(html);
        }
    }

    var arr = new Array();
    arr.push(new obj2());
    arr.push(new obj1());

    var temp = new XmlHandle("test2.xml", "cd1");
    temp.load(arr);
</script>